{template header}
<style type="text/css">
    body{ background-color: #fff; }
    .sfz_box img{ max-height: 167px; }
</style>
    <!-- S header -->
    <header>
        <a href="javascript:;" onClick="javascript :history.back(-1);" class="headerL iconfont">&#xe66a;</a>
        <h1>实名认证</h1>
    </header>
    <!-- E header -->
    <h2 class="my_deal_h2">请上传本人有效期内的身份证</h2>
    <dl class="sfz_box alignC">
        <dt class="title">身份证正面</dt>
        <dd id="img1_box">
            <img src="<?php echo $rzinfo['pic1']==""?"/template/wap/statics/images/sfz1.png":$rzinfo['pic1'];?>" alt="" width="260" class="sfz_img">
            <input type="hidden" name="img1" id="img1" />
            <input type="file" id="file_up" name="上传" style="display:none;"/>
        </dd>
    </dl>
    <dl class="sfz_box alignC">
        <dt class="title">身份证背面</dt>
        <dd id="img2_box">
            <img src="<?php echo $rzinfo['pic2']==""?"/template/wap/statics/images/sfz2.png":$rzinfo['pic2'];?>" alt="" width="260" class="sfz_img">
            <input type="hidden" name="img2" id="img2" />
            <input type="file" id="file_up" name="上传" style="display:none;"/>
        </dd>
    </dl>
    <dl class="sfz_box alignC">
        <dt class="title">手持身份证照</dt>
        <dd id="img3_box">
            <img src="<?php echo $rzinfo['pic3']==""?"/template/wap/statics/images/sfz3.png":$rzinfo['pic3'];?>" alt="" width="260" class="sfz_img">
            <input type="hidden" name="img3" id="img3" />
            <input type="file" id="file_up" name="上传" style="display:none;"/>
        </dd>
    </dl>
    <form class="registerform" action="{U('User/user/dousercert_pic')}" method="post" >
        <input type="hidden" name="pic1" id="pic1" datatype="*" value="<?php echo $rzinfo['pic1'];?>"  nullmsg='请上传身份证正面'>
        <input type="hidden" name="pic2" id="pic2" datatype="*" value="<?php echo $rzinfo['pic2'];?>"  nullmsg='请上传身份证背面'>
        <input type="hidden" name="pic3" id="pic3" datatype="*" value="<?php echo $rzinfo['pic3'];?>"  nullmsg='请上传手持身份证照'>
        <a href="javascript:;" class="service_affirm_btn" onclick="submitForm();">确定</a>
    </form>
</body>

<link href="/statics/js/webuploader/webuploader.css" rel="stylesheet" />
<script src="/statics/js/webuploader/webuploader.js" type="text/javascript"></script>
<script type="text/javascript">


    var img1 = new WebUploader.create({
        auto:true,
        fileVal:'upfile',
        // swf文件路径
        swf: '/statics/js/webuploader/webuploader.swf',
        // 文件接收服务端。
        server: "/index.php?m=attachment&c=upload&a=swfupload",
        // 选择文件的按钮。可选
        formData:{
            "module":"",
            "catid":"",
            "userid":"1",
            "dosubmit":"1",
            "thumb_width":"0",
            "thumb_height":"0",
            "watermark_enable":"1",
            "filetype_post":"jpg|jpeg|gif|bmp|png",
            "swf_auth_key":"57a39f6f7415ec2cdd2b8afd77b57c3f",
            "isadmin":"1"
        },
        // 内部根据当前运行是创建，可能是input元素，也可能是flash.
        pick: {
            id: '#img1_box',
            multiple:false
        },
        accept:{
            title: '图片文件',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/*'
        },
        thumb:{
            width: '110',
            height: '110',
        },
        chunked: false,
        chunkSize:1000000,
        // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
        resize: false
    });
    img1.onUploadSuccess = function( file, response ) {
        var pickid = this.options.pick.id;
        var data = response._raw;
        var arr = data.split(',');
        if(response.url.length > 0) {
            $(pickid).find('img').attr('src', response.url);
            // $(pickid).find('input[type=hidden]').eq(0).attr('value', response.url);
            $("#pic1").attr('value', response.url);
        }
        console.log(response);
    }
    img1.onUploadError = function(file, reason) {
        hd_alert('文件上传错误：' + reason);
    }



    var img2 = new WebUploader.create({
        auto:true,
        fileVal:'upfile',
        // swf文件路径
        swf: '/statics/js/webuploader/webuploader.swf',
        // 文件接收服务端。
        server: "/index.php?m=attachment&c=upload&a=swfupload",
        // 选择文件的按钮。可选
        formData:{
            "module":"",
            "catid":"",
            "userid":"1",
            "dosubmit":"1",
            "thumb_width":"0",
            "thumb_height":"0",
            "watermark_enable":"1",
            "filetype_post":"jpg|jpeg|gif|bmp|png",
            "swf_auth_key":"57a39f6f7415ec2cdd2b8afd77b57c3f",
            "isadmin":"1"
        },
        // 内部根据当前运行是创建，可能是input元素，也可能是flash.
        pick: {
            id: '#img2_box',
            multiple:false
        },
        accept:{
            title: '图片文件',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/*'
        },
        thumb:{
            width: '110',
            height: '110',
        },
        chunked: false,
        chunkSize:1000000,
        // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
        resize: false
    });
    img2.onUploadSuccess = function( file, response ) {
        var pickid = this.options.pick.id;
        var data = response._raw;
        var arr = data.split(',');
        if(response.url.length > 0) {
            $(pickid).find('img').attr('src', response.url);
            // $(pickid).find('input[type=hidden]').eq(0).attr('value', response.url);
            $("#pic2").attr('value', response.url);
        }
        console.log(response);
    }
    img2.onUploadError = function(file, reason) {
        hd_alert('文件上传错误：' + reason);
    }

    var img3 = WebUploader.create({
        auto:true,
        fileVal:'upfile',
        // swf文件路径
        swf: '/statics/js/webuploader/webuploader.swf',
        // 文件接收服务端。
        server: "/index.php?m=attachment&c=upload&a=swfupload",
        // 选择文件的按钮。可选
        formData:{
            "module":"",
            "catid":"",
            "userid":"1",
            "dosubmit":"1",
            "thumb_width":"0",
            "thumb_height":"0",
            "watermark_enable":"1",
            "filetype_post":"jpg|jpeg|gif|bmp|png",
            "swf_auth_key":"57a39f6f7415ec2cdd2b8afd77b57c3f",
            "isadmin":"1"
        },
        // 内部根据当前运行是创建，可能是input元素，也可能是flash.
        pick: {
            id: '#img3_box',
            multiple:false
        },
        accept:{
            title: '图片文件',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/*'
        },
        thumb:{
            width: '110',
            height: '110',
        },
        chunked: false,
        chunkSize:1000000,
        // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
        resize: false
    });
    img3.onUploadSuccess = function( file, response ) {
        var pickid = this.options.pick.id;
        var data = response._raw;
        var arr = data.split(',');
        if(response.url.length > 0) {
            $(pickid).find('img').attr('src', response.url);
            // $(pickid).find('input[type=hidden]').eq(0).attr('value', response.url);
            $("#pic3").attr('value', response.url);
        }
        console.log(response);
    }
    img3.onUploadError = function(file, reason) {
        hd_alert('文件上传错误：' + reason);
    }


    var inx;
    function submitForm(){
        layer.open({type: 2});
        $(".registerform").submit();


    }


    $(".registerform").Validform({
            tiptype:function(msg,o,cssctl){

                if(o.type==3){
                    layer.closeAll();
                    //$(".errmsg").text(msg).show();
                    tips(msg);
                    return false;
                }
                if(o.type==1){
                    o.obj.addClass("Validform_success")
                }
            },
            ajaxPost: true,
            callback: function(ret) {
                layer.closeAll();
                if (ret.status == 0) {
                    //$(".errmsg").text(ret.info).show();
                    tips(ret.info);
                } else {
                    layer.open({
                        content: ret.info
                        ,skin: 'msg'
                        ,time: 2
                        ,end:function(){
                            location.href = "{U('user/index/index')}";
                        }
                    });
                }
            }
    });



</script>
</html>